package edu.njfu.intentdemo

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.Button

class ThirdActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_third)
        //Activity创建时候执行，此时Activity不可见
        Log.d("ThirdActivity","Oncreate is running!")
        val button4=findViewById<Button>(R.id.button4)
        button4.setOnClickListener {
            val intent= Intent(this,SecondActivity::class.java)
            startActivity(intent)
        }
    }

    override fun onStart() {
        super.onStart()
        Log.d("ThirdActivity","onStart is running!")
    }

    override fun onResume() {
        super.onResume()
        Log.d("ThirdActivity","onResume is running!")
    }

    override fun onPause() {
        super.onPause()
        Log.d("ThirdActivity","onPause is running!")
    }

    override fun onStop() {
        super.onStop()
        Log.d("ThirdActivity","onStop is running!")
    }

    override fun onDestroy() {
        super.onDestroy()
        Log.d("ThirdActivity","onDestory is running!")
    }

    override fun onRestart() {
        super.onRestart()
        Log.d("ThirdActivity","onReStart is running!")
    }
}